//
//  SmallCell.m
//  卢卡的时光网
//
//  Created by 卡神 on 15/7/26.
//  Copyright © 2015年 lok. All rights reserved.
//

#import "SmallCell.h"
#import "UIViewExt.h"
#import "UIImageView+WebCache.h"


@implementation SmallCell

#pragma mark -init function 

- (nonnull instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        CGFloat width = self.width * 0.9;//uiviewext
        CGFloat height = self.height * 0.9;
        _image = [[UIImageView alloc] initWithFrame:CGRectMake((self.width - width) / 2, (self.height - height) / 2, width, height)];
        [self.contentView addSubview:_image];
    }
    return self;
}

#pragma mark -set the imageview's iamge
- (void)setImageData:(MoiveInformation *)imageData {
    _imageData = imageData;
    [self setNeedsLayout];
}

- (void)layoutSubviews {
    NSString *imageUrl = [self.imageData.images valueForKey:@"medium"];
    [_image sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageNamed:@"6"]];
}

 


@end
